// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
  if (event.type == 'getCardImage') {
    return await db.collection('ops_card_image').where({
      status: 1,
    }).orderBy('sort', 'asc').get();
  } else if (event.type == 'privacy') {
    return await db.collection('ops_sys_info').field({
      privacy: true,
    }).get();
  } else if (event.type == 'about') {
    return await db.collection('ops_sys_info').field({
      about: true,
    }).get();
  } else if (event.type == 'instruction') {
    return await db.collection('ops_sys_info').field({
      instruction_video: true,
      instruction_text: true,
    }).get();
  }
}